package com.lyt.springboot.controller;

import com.lyt.springboot.domain.UserData;
import org.apache.catalina.User;
import org.junit.Test;
import org.omg.CORBA.PUBLIC_MEMBER;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;

public class MmmmmmTest {
    @Test
    public void test1() {
        String a = "ggg维-返压料";
        boolean b = a.endsWith("返压料");
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(4);
        list.add(3);
        list.add(2);
        System.out.println(b);
    }
    @Test
    public void test2() {
        String a = "ggg维-dwugdu返压料1-oo";
        boolean b = a.contains("返压料");
        System.out.println(b);
    }
    @Test
    public void test3() {
        List<UserData> userList = new ArrayList<>();
        UserData userData = new UserData();
        userData.setId("1");
        userData.setName("张三");
        userData.setPasso("123");
        userData.setIiiccd("123");
        userList.add(userData);

        List<UserData> list = userList.stream().filter(x -> x.getId().equals("1") && x.getName().equals("张三")).collect(Collectors.toList());

    }
    @Test
    public void test4() {
        Map<String,List<UserData>> map = new HashMap<>();
        List<UserData>list = new ArrayList<>();
        UserData userData = new UserData();
        userData.setId("liuliu");
        userData.setName("张三");
        userData.setPasso("123");
        userData.setHeight(12);
        list.add(userData);
        map.put("1",list);

        List<UserData>list2 = new ArrayList<>();
        UserData userData2 = new UserData();
        userData2.setId("liuliu2");
        userData2.setName("李四");
        userData2.setPasso("ruj");
        userData2.setHeight(854);
        list2.add(userData2);
        map.put("2",list2);

        map.forEach((k,v)->{
            if(k.equals("1")) {


            }
            System.out.println(k);
            System.out.println(v);
        });

    }
    @Test
    public void test5() {
        // 创建一个 BigDecimal 对象
        BigDecimal originalValue = new BigDecimal("123.456789");

        // 设置保留两位小数，使用 RoundingMode.HALF_UP（四舍五入）
        BigDecimal roundedValue = originalValue.setScale(2, RoundingMode.HALF_UP);

        // 输出结果
        System.out.println("Original Value: " + originalValue);
        System.out.println("Rounded Value: " + roundedValue);
    }
    @Test
    public void test6() {
        String a = "dddd_fefi";
        String[] s = a.split("_");
        String s1 = s[0];
        System.out.println(s1);
    }
    @Test
    public void tset7() {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 2; j++) {
                int t=t=1;

            }

        }
    }
    @Test
    public void test8() {
        List<Date> list = new ArrayList<>();
        list.stream().max(Comparator.comparing(Date::getTime));

    }
    @Test
    public   void   test9() {
        String a  = "";
        if(a.equals(null)){
            System.out.println("1");
        }else {
            System.out.println("2");
        }

    }
}